#include "StdAfx.h"
#include "DrawLogPolar.h"


CDrawLogPolar::CDrawLogPolar(void)
{
}


CDrawLogPolar::~CDrawLogPolar(void)
{
}
BEGIN_MESSAGE_MAP(CDrawLogPolar, CDrawOpenCV)
	ON_WM_PAINT()
END_MESSAGE_MAP()




void CDrawLogPolar::DealwithFrame()
{
	// TODO: Add your command handler code here
	if(m_pFrame == NULL)
	{			
		return ;
	}
	if(m_pShow != NULL)
	{
		cvReleaseImage(&m_pShow);
	}


	cvFlip(m_pFrame); 
    IplImage* dst = cvCreateImage( cvSize(m_pFrame->width/2,m_pFrame->height/2), 8, 3 );
    IplImage* src2 = cvCreateImage( cvGetSize(m_pFrame), 8, 3 );
    cvLogPolar( m_pFrame, dst, cvPoint2D32f(m_pFrame->width/2,m_pFrame->height/2), 40, 
		CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS );
    cvLogPolar( dst, src2, cvPoint2D32f(m_pFrame->width/2,m_pFrame->height/2), 40, 
		CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS+CV_WARP_INVERSE_MAP );

    //cvNamedWindow( "log-polar", 1 );
    //cvShowImage( "log-polar", dst );
    //cvNamedWindow( "inverse log-polar", 1 );
    //cvShowImage( "inverse log-polar", src2 );

	m_pShow = cvCloneImage( src2 );
    //cvWaitKey();
    //cvDestroyWindow( "log-polar" );
    //cvDestroyWindow( "inverse log-polar" );
    //cvReleaseImage(&src);
    //cvReleaseImage(&dst);
    cvReleaseImage(&src2);

}
